-
Notifications
You must be signed in to change notification settings - Fork 30
Initial separation of dparray into 2 parts. #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Need tests. @vlad-perevezentsev could write tests. @DrTodd13 could you provide an idea how to test this? |
This PR have an issue to fix: can not import dparray from dpctl.
Also, have an errror:
|
Some tests for dparray could be taken from https://github.com/IntelPython/numba/pull/116/files#diff-74090bd7024ff78832de33f87c13b014c1646982a2c286e6200913699be5d91e. |
Related to #188 |
What's the best way to push changes to this branch? Here is where it stands now, with proposed changes applied:
|
sys.stdout.flush() | ||
|
||
import dpctl | ||
from dpctl._memory import MemoryUSMShared |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be from dpctl.memory import MemoryUSMShared
.
functions_list = [o[0] for o in getmembers(np) if isfunction(o[1]) or isbuiltin(o[1])] | ||
class_list = [o for o in getmembers(np) if isclass(o[1])] | ||
|
||
array_interface_property = "__array_interface__" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be __sycl_usm_array_interface__
instead.
nelems = np.prod(shape) | ||
dt = np.dtype(dtype) | ||
isz = dt.itemsize | ||
buf = MemoryUSMShared(nbytes=isz*max(1,nelems)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be
nbytes = int(isz*max(1, nelems))
buf = MemoryUSMShared(nbytes)
dtype=dtype, buffer=buffer, | ||
offset=offset, strides=strides, | ||
order=order) | ||
buf = MemoryUSMShared(nbytes=ar.nbytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, should be
nbytes = int(ar.nbytes)
buf = MemoryUSMShared(nbytes)
# subclass of ndarray, including our own. | ||
if hasattr(obj, array_interface_property): | ||
return | ||
if isinstance(obj, numba.core.runtime._nrt_python._MemInfo): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numba
is undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DrTodd13 Why we use this function from numba? Is it optional? Can we copy this function to our code?
Method
|
@oleksandr-pavlyk I will fix all your review and notes tomorrow. This PR is in the core of many further modifications and I would like to merge it tomorrow after fixing and tests adding. |
@oleksandr-pavlyk @DrTodd13 How it could be fixed? Is it ok to create a separate issue for it and fix in separate PR? |
This isn't complete since I wasn't able to get the file showing up as part of the package so I wasn't able to test much. Help needed!